<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoreServiceRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('store_service_records', function (Blueprint $table) {
            $table->id()->comment('客服聊天用户记录表');
            $table->integer('sender_user_id')->comment('发送人id')->index();
            $table->integer('receiver_user_id')->comment('接收人id')->index();
            $table->string('nickname')->comment('用户昵称');
            $table->string('avatar')->comment('用户头像');
            $table->integer('news_num')->comment('消息条数  ');
            $table->text('news_content')->comment('消息内容');
            $table->string('news_type',20)->default('writtenWords')->comment('消息类型 writtenWords=文字 expression=表情 picture=图片 voice=语音');
            $table->tinyInteger('is_tourist')->default(0)->comment('是否是游客 1=游客模式，0=非游客');
            $table->tinyInteger('is_online')->default(0)->comment('是否在线 1=在线，0=不在线');
            $table->string('type',20)->default('pc')->comment('类型  pc= pc,weChat=微信，applet=小程序，H5=H5');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('store_service_records');
    }
}
